package org.zht.dormpro.dorm.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.zht.dormpro.dorm.model.TbWaterElec;

public interface TbWaterElecMapper {
    @Delete({
        "delete from tb_water_elec",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into tb_water_elec (id, dorm_id, ",
        "dorm_water_num, dorm_elec_num, ",
        "record_time, we_append, ",
        "we_status)",
        "values (#{id,jdbcType=INTEGER}, #{dormId,jdbcType=VARCHAR}, ",
        "#{dormWaterNum,jdbcType=INTEGER}, #{dormElecNum,jdbcType=INTEGER}, ",
        "#{recordTime,jdbcType=BIGINT}, #{weAppend,jdbcType=VARCHAR}, ",
        "#{weStatus,jdbcType=TINYINT})"
    })
    int insert(TbWaterElec record);

    int insertSelective(TbWaterElec record);

    @Select({
        "select",
        "id, dorm_id, dorm_water_num, dorm_elec_num, record_time, we_append, we_status",
        "from tb_water_elec",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("org.zht.dormpro.dorm.mapper.TbWaterElecMapper.BaseResultMap")
    TbWaterElec selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(TbWaterElec record);

    @Update({
        "update tb_water_elec",
        "set dorm_id = #{dormId,jdbcType=VARCHAR},",
          "dorm_water_num = #{dormWaterNum,jdbcType=INTEGER},",
          "dorm_elec_num = #{dormElecNum,jdbcType=INTEGER},",
          "record_time = #{recordTime,jdbcType=BIGINT},",
          "we_append = #{weAppend,jdbcType=VARCHAR},",
          "we_status = #{weStatus,jdbcType=TINYINT}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(TbWaterElec record);
}